package com.ymatou.iapi.trading.operate2.parameter.model.placeorder;

import java.util.ArrayList;
import java.util.List;

import com.ymatou.iapi.trading.operate2.parameter.enums.BizTypeEnum;
import com.ymatou.iapi.trading.operate2.parameter.req.PlaceOrderReq;

/**
 */
public class MainOrder {

	private PlaceOrderReq placeOrderReq;

	private int orderCount;

	private List<OrderGroup> orderGroups = new ArrayList<OrderGroup>();

	private List<String> couponCodes = new ArrayList<String>();

	public PlaceOrderReq getPlaceOrderReq() {
		return placeOrderReq;
	}

	public void setPlaceOrderReq(PlaceOrderReq placeOrderReq) {
		this.placeOrderReq = placeOrderReq;
	}

	public List<OrderGroup> getOrderGroups() {
		return orderGroups;
	}

	public void setOrderGroups(List<OrderGroup> orderGroups) {
		this.orderGroups = orderGroups;
	}

	public int getOrderCount() {
		return orderCount;
	}

	public void setOrderCount(int orderCount) {
		this.orderCount = orderCount;
	}

	public List<String> getCouponCodes() {
		return couponCodes;
	}

	public void setCouponCodes(List<String> couponCodes) {
		this.couponCodes = couponCodes;
	}

	public boolean needsReduceProdStocks() {
		/**
		 * 砍价团：外部扣好库存再调交易
		 * 非砍价团：交易负责扣库存
		 */
		return !(placeOrderReq.getBizSource() != null && BizTypeEnum
				.isBargin(placeOrderReq.getBizSource().getBizType()));
	}

	public boolean needsReduceCoupons() {
		return couponCodes.size() > 0;
	}
}
